/************************************************************************/
/* 
Lame mp3 audio codec class 
author pengl
date 2008-11-26
*/
/************************************************************************/

#include "StdAfx.h"
#include ".\lameopts.h"



static char *lame_name = "lamemp3"; 
static char glameopts[1024] = {0};


ClameOpts::ClameOpts(void)
{
	m_lameopts.lame_param_br = 128;
	m_lameopts.lame_param_mode = 3;
	m_lameopts.lame_param_quality = 0; //defalt best quality
	m_lameopts.lame_param_vbr = lame_CBR;
}

ClameOpts::~ClameOpts(void)
{
#ifdef _DEBUG
	fprintf(stdout, "ClameOpts release \n");
#endif
}

char *ClameOpts::get_myname()
{
	return lame_name;
}

void ClameOpts::set_lameopts(Plameopts opts)
{
	m_lameopts = *opts;
}


char *ClameOpts::get_lameopts()
{
	char lame_vbr[20] = { 0 };
	switch(m_lameopts.lame_param_vbr) {
	case lame_VBR:
		sprintf(lame_vbr, "%s", "vbr");
		break;
	case lame_CBR:
		sprintf(lame_vbr, "%s", "cbr");
		break;
	case lame_ABR:
		sprintf(lame_vbr, "%s", "abr");
		break;
	default:
		sprintf(lame_vbr, "%s", "cbr");
	}
	sprintf(glameopts, "-oac mp3lame -lameopts mode=%d:%s:br=%d ", 
			m_lameopts.lame_param_mode,
			lame_vbr, m_lameopts.lame_param_br);

	return glameopts;
}